<?php

namespace app\index\controller;

use app\common\BaseVisitController;
use app\common\RenderJson;
use app\model\LeaveaMessage;
use app\model\MyBriefing;

class Index extends BaseVisitController {
	public function index() {
		$this->assign ( 'myBriefing', MyBriefing::getNew () );
		return $this->fetch ();
	}
	public function contact() {
		$result = new RenderJson ();
		$data = $this->request->param ();
		$data ['host'] = $this->request->ip ();
		if (LeaveaMessage::create ( $data )) {
			$result->success ( true, '添加成功' );
		} else {
			$result->msg ( '添加失败' );
		}
		return $this->json ( $result );
	}
}
